<script setup lang="ts">
import useUserStore from "@/store/modules/user";
import { computed } from "vue";
const { usePermissions } = useUserStore();
const props = defineProps({
  permissions: {
    type: [Array, String],
  },
});
const showSlot = computed(() => {
  if (!props.permissions) {
    return true;
  }
  if (!usePermissions) {
    return false;
  }
  if (Array.isArray(props.permissions)) {
    return props.permissions.every((item) => usePermissions.includes(item));
  }
  return usePermissions.includes(props.permissions);
});
</script>

<template>
  <slot v-if="showSlot" :usePermissions="permissions"></slot>
</template>

<style lang="scss" scoped></style>
